$(function() {
	var LoginedUser = getLoginedUser();
	if(LoginedUser==null || isEmpty(LoginedUser.account)) {
		alert('您未登录或者登录已经过期');
		return;
	}
	
	$('#account').val(LoginedUser.account);
});

function save() {
	var LoginedUser = getLoginedUser();
	if(LoginedUser==null || isEmpty(LoginedUser.accountId)) {
		alert('您未登录或者登录已经过期');
		return;
	}
	
	var accountId = LoginedUser.accountId;
	var oldPassword = $('#oldPassword').val();
	var password = $('#password').val();
	var password_cfm = $('#password_cfm').val();
	
	if(isEmpty(oldPassword)) {
		alert('请输入旧密码');
		return;
	}
	if(isEmpty(password)) {
		alert('请输入新密码');
		return;
	}
	if(isEmpty(password_cfm)) {
		alert('请再次输入新密码');
		return;
	}
	if(password != password_cfm) {
		alert('两次新密码输入不一致');
		return;
	}
	
	save_basic_by_json(path+'/account/updatePassword', {accountId:accountId, oldPassWord:oldPassword, passWord:password}, function() {
		alert('密码修改成功，请记住新密码');
	});
}

function findStaffInfo() {
	if($('#vue_vm_list').length==0) {return;}
	$('#vue_vm_list div').hide();
	var searchVal = $('#searchVal').val();
	
	openWaiting('正在查找');
	
	find_basic(path+'/staffInfo/find', searchVal, function(response) {
		$('#account').val(response.data[0].phoneNumber);
		$('#vue_vm_list').html(gl_vue_vm_list_html);
		
		new Vue({
			el: '#vue_vm_list',
			data: {
				todos: response.data
			}
		});
		
		$('#vue_vm_list div').show();
		
		closeWaiting();
	});
}